/**
 * @file mutate.h
 * @brief Functions for mutating a module
 * @author Scott Moyers
 * @date 2009
 */

#ifndef MY_MUTATE_H
#define MY_MUTATE_H

#include "module.h"
#include "dSFMT.h"

/** Creates a type for function pointers to mutation functions */
typedef int (*MutationFunc) (dsfmt_t *dsfmt, struct Module *m);

/** numer of mutation functions, update as necessary */
#define MUT_FUNCS (2)

/**
 * moves a gates input source to somewhere else
 * @param dsfmt the random number generator
 * @param m the module to perform the random switch on
 * @retval 1 on failure to switch wires
 * @retval 0 on success
 */
int move_wire(dsfmt_t *dsfmt, struct Module *m);

/**
 * randomly pick a gate and change it type to another
 * @param dsfmt the random number generator
 * @param m the module to mutate
 * @retval 1 on failure
 * @retval 0 on success
 */
int change_gate_type(dsfmt_t *dsfmt, struct Module *m);

/**
 * gets a function pointer to the function named "func"
 * @param func name of a mutation function
 * @retval a function pointer
 * @retval NULL if the function doesn't exist
 */
MutationFunc get_mutation_func(const char *func);

#endif
